package com.leochan.shuniu.api;

import org.scribe.encoders.URLHelper;
import org.scribe.http.Request;
import org.scribe.http.Response;
import org.scribe.http.Verb;
import org.scribe.oauth.Token;

import com.leochan.shuniu.Global;
import com.leochan.utils.DebugUtils;

public class NetworkAPI extends BaseAPI {

	private static final String networks_str = "http://api.shuniu.net/api/v1/networks/current.json%s";

	private static final String Include_suspended = "include_suspended";
	private static final String Exclude_own_messages_from_unseen = "exclude_own_messages_from_unseen";

	// GET http://api.shuniu.net/api/v1/networks/current.json
	public static void current(Token token, boolean include_suspended,
			boolean exclude_own_messages_from_unseen) {
		DebugUtils.printLogD();
		initParams(token);
		params.put(Include_suspended, include_suspended);
		params.put(Exclude_own_messages_from_unseen,
				exclude_own_messages_from_unseen);
		String format = String.format(networks_str,
				URLHelper.queryString(params));
		DebugUtils.printLogD(format);
		Request req = new Request(Verb.GET, format);
		Response resp = req.send(Global.proxy);
		DebugUtils.printLogD(resp.getBody());
		DebugUtils.printLogD("====================================");
	}
}
